/**
 *
 */
import instance from "@/api/axios";



/** 
 * 上传
 * @param {*} param 
 * @returns 
 */
async function uploadResource(param) {
    /**
     * 请求接口
     */
    const { status, message, msg } = await instance.post(
        "uploadResource",
        param
    );
    return { status, message, msg };
}



/** 
 * 根据训练集id获取路径详情
 * @param {*} param 
 * @returns 
 */
async function getFolderInfo(id) {
    /**
     * 请求接口
     */
    const { status, message, msg } = await instance.get("getFolderInfo?id=" + id);
    return { status, message, msg };
}






/** 
 * 批量删除图片
 * @param {*} param 
 * @returns 
 */
async function batchDeleteResource(collectionIds) {
    console.log(collectionIds);

    /**
     * 请求接口
     */
    const { status, message, msg } = await instance.delete("batchDeleteResource?collectionIds=" + collectionIds,);
    return { status, message, msg };
}




/** 
 * 批量删除图片
 * @param {*} param 
 * @returns 
 */
async function deleteAllResource(trainingSetId) {
    /**
     * 请求接口
     */
    const { status, message, msg } = await instance.delete("deleteAllResource?trainingSetId=" + trainingSetId,);
    return { status, message, msg };
}




/** 
 * 训练集资源列表
 * @param {*} param 
 * @returns 
 */
async function getResourceList(param) {
    /**
     * 请求接口
     */
    const { status, message, msg } = await instance.post(
        "getResourceList",
        param
    );
    return { status, message, msg };
}








export default {
    uploadResource,
    getFolderInfo,
    batchDeleteResource,
    deleteAllResource,
    getResourceList,
};
